import NValueSync from "../../ngame/sync/state/tools/NValueSync";
import { IRoleController, RoleDir } from "../controller/IRoleController";

export default class NSyncRoleDir extends NValueSync<RoleDir>{

    role:IRoleController;
    dir:RoleDir;
    
    constructor(role:IRoleController){
        super("del");
        this.role = role;
    }

    getValue(): RoleDir {
        return this.role.roleDir;
    }
    getNextValue(): RoleDir {

        if(this.dir != this.role.roleDir){
            this.dir = this.role.roleDir;
            return this.role.roleDir;
        }else{
            return null;
        }
        
    }
    syncUpdate(value: RoleDir, dt: number) {
        console.log("NSyncRoleDir",value);
        if(value != null || value != undefined){
            this.role.roleDir = value;
        }
    }

    
}